package com.message.queue.rabbit.direct;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Created by zhangbo on 2020/7/17.
 */
@Component
@RabbitListener(queues = "myDirectQueue")
public class DirectReveiver {

//    @RabbitHandler
//    public void process(String message) {
//        System.out.println("接收到消息：" + message);
//    }

    @RabbitHandler
    public void process(Object message) {
        Message myMessage = (Message) message;
        System.out.println("接收到消息：" + new String(myMessage.getBody()));
    }

}
